import { reqGetDetailList } from '@/api'
const state = {
  detailList: {}
}

const mutations = {
  GETDETAILLIST(state, detailList) {
    state.detailList = detailList
  }
}

const actions = {
  async getDetailList({ commit }) {
    // eslint-disable-next-line prefer-const
    let result = await reqGetDetailList()
    console.log(result)
    if (result.code === 200) {
      commit('GETDETAILLIST', result.data)
    }
  }
}

const getters = {
  gallaryImgs(state) {
    return state.detailList.gallaryImgs || []
  },
  categoryList(state) {
    return state.detailList.categoryList || []
  }
}
export default {
  state,
  mutations,
  actions,
  getters
}
